{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# **Elliptic++ Transactions Dataset**\n",
        "\n",
        "\n",
        "---\n",
        "---\n",
        "\n",
        "\n",
        "Released by: Youssef Elmougy, Ling Liu\n",
        "\n",
        "\n",
        "\n",
        "School of Computer Science, Georgia Institute of Technology\n",
        "\n",
        "Contact: yelmougy3@gatech.edu\n",
        "\n",
        "\n",
        "---\n",
        "\n",
        "Github Repository: [https://www.github.com/git-disl/EllipticPlusPlus](https://www.github.com/git-disl/EllipticPlusPlus)\n",
        "\n",
        "\n",
        "If you use our dataset in your work, please cite our paper:\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "\n",
        ">> Youssef Elmougy and Ling Liu. 2023. Demystifying Fraudulent Transactions and Illicit Nodes in the Bitcoin Network for Financial Forensics.\n",
        "\n",
        "---\n",
        "\n"
      ],
      "metadata": {
        "id": "O34u-DVsX4jx"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## [SETUP] Import libraries and csv files "
      ],
      "metadata": {
        "id": "ReHrhaPiaiI-"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Download dataset from: [https://www.github.com/git-disl/EllipticPlusPlus](https://www.github.com/git-disl/EllipticPlusPlus)"
      ],
      "metadata": {
        "id": "TLi0Zc7j6Rb6"
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "eUbJT_J-A1Mw",
        "outputId": "6e64f92e-3bac-4dbc-b4f2-d57489140473"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Mounted at /content/drive\n"
          ]
        }
      ],
      "source": [
        "from google.colab import drive\n",
        "drive.mount('/content/drive')\n",
        "!cp drive/My\\ Drive/Elliptic++\\ Dataset/txs_features.csv ./\n",
        "!cp drive/My\\ Drive/Elliptic++\\ Dataset/txs_classes.csv ./\n",
        "!cp drive/My\\ Drive/Elliptic++\\ Dataset/txs_edgelist.csv ./"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "kz7WtWhG6MtI",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "ba02acc2-6f29-4d71-c5df-2d6bc5c61453"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
            "Requirement already satisfied: ipython in /usr/local/lib/python3.8/dist-packages (8.9.0)\n",
            "Requirement already satisfied: decorator in /usr/local/lib/python3.8/dist-packages (from ipython) (4.4.2)\n",
            "Requirement already satisfied: pexpect>4.3 in /usr/local/lib/python3.8/dist-packages (from ipython) (4.8.0)\n",
            "Requirement already satisfied: matplotlib-inline in /usr/local/lib/python3.8/dist-packages (from ipython) (0.1.6)\n",
            "Requirement already satisfied: stack-data in /usr/local/lib/python3.8/dist-packages (from ipython) (0.6.2)\n",
            "Requirement already satisfied: jedi>=0.16 in /usr/local/lib/python3.8/dist-packages (from ipython) (0.18.2)\n",
            "Requirement already satisfied: traitlets>=5 in /usr/local/lib/python3.8/dist-packages (from ipython) (5.7.1)\n",
            "Requirement already satisfied: pickleshare in /usr/local/lib/python3.8/dist-packages (from ipython) (0.7.5)\n",
            "Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.30 in /usr/local/lib/python3.8/dist-packages (from ipython) (3.0.36)\n",
            "Requirement already satisfied: backcall in /usr/local/lib/python3.8/dist-packages (from ipython) (0.2.0)\n",
            "Requirement already satisfied: pygments>=2.4.0 in /usr/local/lib/python3.8/dist-packages (from ipython) (2.6.1)\n",
            "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /usr/local/lib/python3.8/dist-packages (from jedi>=0.16->ipython) (0.8.3)\n",
            "Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.8/dist-packages (from pexpect>4.3->ipython) (0.7.0)\n",
            "Requirement already satisfied: wcwidth in /usr/local/lib/python3.8/dist-packages (from prompt-toolkit<3.1.0,>=3.0.30->ipython) (0.2.5)\n",
            "Requirement already satisfied: executing>=1.2.0 in /usr/local/lib/python3.8/dist-packages (from stack-data->ipython) (1.2.0)\n",
            "Requirement already satisfied: asttokens>=2.1.0 in /usr/local/lib/python3.8/dist-packages (from stack-data->ipython) (2.2.1)\n",
            "Requirement already satisfied: pure-eval in /usr/local/lib/python3.8/dist-packages (from stack-data->ipython) (0.2.2)\n",
            "Requirement already satisfied: six in /usr/local/lib/python3.8/dist-packages (from asttokens>=2.1.0->stack-data->ipython) (1.15.0)\n"
          ]
        }
      ],
      "source": [
        "import numpy as np\n",
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "import seaborn as sns\n",
        "import networkx as nx\n",
        "import plotly.graph_objs as go \n",
        "import plotly.offline as py \n",
        "import math\n",
        "\n",
        "!pip install -U ipython \n",
        "from IPython.core.interactiveshell import InteractiveShell\n",
        "InteractiveShell.ast_node_interactivity = 'all'"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.model_selection import train_test_split\n",
        "from sklearn.ensemble import RandomForestClassifier\n",
        "from sklearn.metrics import precision_recall_fscore_support\n",
        "from sklearn.model_selection import train_test_split\n",
        "from sklearn.linear_model import LogisticRegression\n",
        "from sklearn.neural_network import MLPClassifier\n",
        "from sklearn.metrics import f1_score, accuracy_score, confusion_matrix\n",
        "from sklearn.cluster import KMeans\n",
        "from sklearn.model_selection import GridSearchCV\n",
        "from sklearn.preprocessing import MinMaxScaler\n",
        "from sklearn.ensemble import VotingClassifier\n",
        "from sklearn.base import clone \n",
        "\n",
        "import xgboost as xgb"
      ],
      "metadata": {
        "id": "TKJFAkVLp34j"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "!pip install eli5\n",
        "import eli5\n",
        "from eli5.sklearn import PermutationImportance"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "bRW1hh3S4pbS",
        "outputId": "af64ff37-eb12-4dd8-faba-628b9b695aec"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
            "Collecting eli5\n",
            "  Downloading eli5-0.13.0.tar.gz (216 kB)\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m216.2/216.2 KB\u001b[0m \u001b[31m15.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "Requirement already satisfied: attrs>17.1.0 in /usr/local/lib/python3.8/dist-packages (from eli5) (22.2.0)\n",
            "Collecting jinja2>=3.0.0\n",
            "  Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m133.1/133.1 KB\u001b[0m \u001b[31m15.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25hRequirement already satisfied: numpy>=1.9.0 in /usr/local/lib/python3.8/dist-packages (from eli5) (1.21.6)\n",
            "Requirement already satisfied: scipy in /usr/local/lib/python3.8/dist-packages (from eli5) (1.7.3)\n",
            "Requirement already satisfied: six in /usr/local/lib/python3.8/dist-packages (from eli5) (1.15.0)\n",
            "Requirement already satisfied: scikit-learn>=0.20 in /usr/local/lib/python3.8/dist-packages (from eli5) (1.0.2)\n",
            "Requirement already satisfied: graphviz in /usr/local/lib/python3.8/dist-packages (from eli5) (0.10.1)\n",
            "Requirement already satisfied: tabulate>=0.7.7 in /usr/local/lib/python3.8/dist-packages (from eli5) (0.8.10)\n",
            "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.8/dist-packages (from jinja2>=3.0.0->eli5) (2.0.1)\n",
            "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.8/dist-packages (from scikit-learn>=0.20->eli5) (3.1.0)\n",
            "Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.8/dist-packages (from scikit-learn>=0.20->eli5) (1.2.0)\n",
            "Building wheels for collected packages: eli5\n",
            "  Building wheel for eli5 (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "  Created wheel for eli5: filename=eli5-0.13.0-py2.py3-none-any.whl size=107748 sha256=138c7b7afc731dc3a39e6bd4e82b7a9fa2f965be699cbe7c19820bc09cf8bfa4\n",
            "  Stored in directory: /root/.cache/pip/wheels/85/ac/25/ffcd87ef8f9b1eec324fdf339359be71f22612459d8c75d89c\n",
            "Successfully built eli5\n",
            "Installing collected packages: jinja2, eli5\n",
            "  Attempting uninstall: jinja2\n",
            "    Found existing installation: Jinja2 2.11.3\n",
            "    Uninstalling Jinja2-2.11.3:\n",
            "      Successfully uninstalled Jinja2-2.11.3\n",
            "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
            "notebook 5.7.16 requires jinja2<=3.0.0, but you have jinja2 3.1.2 which is incompatible.\n",
            "google-colab 1.0.0 requires ipython~=7.9.0, but you have ipython 8.9.0 which is incompatible.\n",
            "flask 1.1.4 requires Jinja2<3.0,>=2.10.1, but you have jinja2 3.1.2 which is incompatible.\u001b[0m\u001b[31m\n",
            "\u001b[0mSuccessfully installed eli5-0.13.0 jinja2-3.1.2\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Transactions Dataset Overview\n",
        "\n",
        "\n",
        "---\n",
        "\n",
        "This section loads the 3 csv files (txs_features, txs_classes, txs_edgelist) and provides a quick overview of the dataset structure and features."
      ],
      "metadata": {
        "id": "y3JLmL3SfJqP"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Load saved transactions dataset csv files:"
      ],
      "metadata": {
        "id": "ZcdjXmV8gr8S"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(\"\\nTransaction features: \\n\")\n",
        "df_txs_features = pd.read_csv(\"txs_features.csv\")\n",
        "df_txs_features\n",
        "\n",
        "print(\"\\nTransaction classes: \\n\")\n",
        "df_txs_classes = pd.read_csv(\"txs_classes.csv\")\n",
        "df_txs_classes\n",
        "\n",
        "print(\"\\nTransaction-Transaction edgelist: \\n\")\n",
        "df_txs_edgelist = pd.read_csv(\"txs_edgelist.csv\")\n",
        "df_txs_edgelist"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "dNNEwGmae2Eo",
        "outputId": "3ed76d40-095b-42dc-8362-5eb54958b88a"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "Transaction features: \n",
            "\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "             txId  Time step  Local_feature_1  Local_feature_2  \\\n",
              "0            3321          1        -0.169615        -0.184668   \n",
              "1           11108          1        -0.137586        -0.184668   \n",
              "2           51816          1        -0.170103        -0.184668   \n",
              "3           68869          1        -0.114267        -0.184668   \n",
              "4           89273          1         5.202107        -0.210553   \n",
              "...           ...        ...              ...              ...   \n",
              "203764  158304003         49        -0.165622        -0.139563   \n",
              "203765  158303998         49        -0.167040        -0.139563   \n",
              "203766  158303966         49        -0.167040        -0.139563   \n",
              "203767  161526077         49        -0.172212        -0.139573   \n",
              "203768  194103537         49        -0.172212        -0.139573   \n",
              "\n",
              "        Local_feature_3  Local_feature_4  Local_feature_5  Local_feature_6  \\\n",
              "0             -1.201369        -0.121970        -0.043875        -0.113002   \n",
              "1             -1.201369        -0.121970        -0.043875        -0.113002   \n",
              "2             -1.201369        -0.121970        -0.043875        -0.113002   \n",
              "3             -1.201369         0.028105        -0.043875        -0.113002   \n",
              "4             -1.756361        -0.121970       260.090707        -0.113002   \n",
              "...                 ...              ...              ...              ...   \n",
              "203764         1.018602        -0.121970        -0.043875        -0.113002   \n",
              "203765         1.018602        -0.121970        -0.043875        -0.113002   \n",
              "203766         1.018602        -0.121970        -0.043875        -0.113002   \n",
              "203767         1.018602        -0.121970        -0.043875        -0.113002   \n",
              "203768         1.018602        -0.121970        -0.043875        -0.113002   \n",
              "\n",
              "        Local_feature_7  Local_feature_8  ...  in_BTC_min  in_BTC_max  \\\n",
              "0             -0.061584        -0.160199  ...    0.534072    0.534072   \n",
              "1             -0.061584        -0.127429  ...    5.611878    5.611878   \n",
              "2             -0.061584        -0.160699  ...    0.456608    0.456608   \n",
              "3              0.547008        -0.161652  ...    0.308900    8.000000   \n",
              "4             -0.061584         5.335864  ...  852.164680  852.164680   \n",
              "...                 ...              ...  ...         ...         ...   \n",
              "203764        -0.061584        -0.156113  ...         NaN         NaN   \n",
              "203765        -0.061584        -0.157564  ...         NaN         NaN   \n",
              "203766        -0.061584        -0.157564  ...         NaN         NaN   \n",
              "203767        -0.061584        -0.162856  ...         NaN         NaN   \n",
              "203768        -0.061584        -0.162856  ...         NaN         NaN   \n",
              "\n",
              "        in_BTC_mean  in_BTC_median  in_BTC_total   out_BTC_min  out_BTC_max  \\\n",
              "0          0.534072       0.534072      0.534072  1.668990e-01     0.367074   \n",
              "1          5.611878       5.611878      5.611878  5.861940e-01     5.025584   \n",
              "2          0.456608       0.456608      0.456608  2.279902e-01     0.228518   \n",
              "3          3.102967       1.000000      9.308900  1.229000e+00     8.079800   \n",
              "4        852.164680     852.164680    852.164680  1.300000e-07    41.264036   \n",
              "...             ...            ...           ...           ...          ...   \n",
              "203764          NaN            NaN           NaN           NaN          NaN   \n",
              "203765          NaN            NaN           NaN           NaN          NaN   \n",
              "203766          NaN            NaN           NaN           NaN          NaN   \n",
              "203767          NaN            NaN           NaN           NaN          NaN   \n",
              "203768          NaN            NaN           NaN           NaN          NaN   \n",
              "\n",
              "        out_BTC_mean  out_BTC_median  out_BTC_total  \n",
              "0           0.266986        0.266986       0.533972  \n",
              "1           2.805889        2.805889       5.611778  \n",
              "2           0.228254        0.228254       0.456508  \n",
              "3           4.654400        4.654400       9.308800  \n",
              "4           0.065016        0.000441     852.164680  \n",
              "...              ...             ...            ...  \n",
              "203764           NaN             NaN            NaN  \n",
              "203765           NaN             NaN            NaN  \n",
              "203766           NaN             NaN            NaN  \n",
              "203767           NaN             NaN            NaN  \n",
              "203768           NaN             NaN            NaN  \n",
              "\n",
              "[203769 rows x 184 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-c00063ae-35bb-4adf-8b2f-f7a6d2444a13\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>txId</th>\n",
              "      <th>Time step</th>\n",
              "      <th>Local_feature_1</th>\n",
              "      <th>Local_feature_2</th>\n",
              "      <th>Local_feature_3</th>\n",
              "      <th>Local_feature_4</th>\n",
              "      <th>Local_feature_5</th>\n",
              "      <th>Local_feature_6</th>\n",
              "      <th>Local_feature_7</th>\n",
              "      <th>Local_feature_8</th>\n",
              "      <th>...</th>\n",
              "      <th>in_BTC_min</th>\n",
              "      <th>in_BTC_max</th>\n",
              "      <th>in_BTC_mean</th>\n",
              "      <th>in_BTC_median</th>\n",
              "      <th>in_BTC_total</th>\n",
              "      <th>out_BTC_min</th>\n",
              "      <th>out_BTC_max</th>\n",
              "      <th>out_BTC_mean</th>\n",
              "      <th>out_BTC_median</th>\n",
              "      <th>out_BTC_total</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>3321</td>\n",
              "      <td>1</td>\n",
              "      <td>-0.169615</td>\n",
              "      <td>-0.184668</td>\n",
              "      <td>-1.201369</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.160199</td>\n",
              "      <td>...</td>\n",
              "      <td>0.534072</td>\n",
              "      <td>0.534072</td>\n",
              "      <td>0.534072</td>\n",
              "      <td>0.534072</td>\n",
              "      <td>0.534072</td>\n",
              "      <td>1.668990e-01</td>\n",
              "      <td>0.367074</td>\n",
              "      <td>0.266986</td>\n",
              "      <td>0.266986</td>\n",
              "      <td>0.533972</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>11108</td>\n",
              "      <td>1</td>\n",
              "      <td>-0.137586</td>\n",
              "      <td>-0.184668</td>\n",
              "      <td>-1.201369</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.127429</td>\n",
              "      <td>...</td>\n",
              "      <td>5.611878</td>\n",
              "      <td>5.611878</td>\n",
              "      <td>5.611878</td>\n",
              "      <td>5.611878</td>\n",
              "      <td>5.611878</td>\n",
              "      <td>5.861940e-01</td>\n",
              "      <td>5.025584</td>\n",
              "      <td>2.805889</td>\n",
              "      <td>2.805889</td>\n",
              "      <td>5.611778</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>51816</td>\n",
              "      <td>1</td>\n",
              "      <td>-0.170103</td>\n",
              "      <td>-0.184668</td>\n",
              "      <td>-1.201369</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.160699</td>\n",
              "      <td>...</td>\n",
              "      <td>0.456608</td>\n",
              "      <td>0.456608</td>\n",
              "      <td>0.456608</td>\n",
              "      <td>0.456608</td>\n",
              "      <td>0.456608</td>\n",
              "      <td>2.279902e-01</td>\n",
              "      <td>0.228518</td>\n",
              "      <td>0.228254</td>\n",
              "      <td>0.228254</td>\n",
              "      <td>0.456508</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>68869</td>\n",
              "      <td>1</td>\n",
              "      <td>-0.114267</td>\n",
              "      <td>-0.184668</td>\n",
              "      <td>-1.201369</td>\n",
              "      <td>0.028105</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>0.547008</td>\n",
              "      <td>-0.161652</td>\n",
              "      <td>...</td>\n",
              "      <td>0.308900</td>\n",
              "      <td>8.000000</td>\n",
              "      <td>3.102967</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>9.308900</td>\n",
              "      <td>1.229000e+00</td>\n",
              "      <td>8.079800</td>\n",
              "      <td>4.654400</td>\n",
              "      <td>4.654400</td>\n",
              "      <td>9.308800</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>89273</td>\n",
              "      <td>1</td>\n",
              "      <td>5.202107</td>\n",
              "      <td>-0.210553</td>\n",
              "      <td>-1.756361</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>260.090707</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>5.335864</td>\n",
              "      <td>...</td>\n",
              "      <td>852.164680</td>\n",
              "      <td>852.164680</td>\n",
              "      <td>852.164680</td>\n",
              "      <td>852.164680</td>\n",
              "      <td>852.164680</td>\n",
              "      <td>1.300000e-07</td>\n",
              "      <td>41.264036</td>\n",
              "      <td>0.065016</td>\n",
              "      <td>0.000441</td>\n",
              "      <td>852.164680</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203764</th>\n",
              "      <td>158304003</td>\n",
              "      <td>49</td>\n",
              "      <td>-0.165622</td>\n",
              "      <td>-0.139563</td>\n",
              "      <td>1.018602</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.156113</td>\n",
              "      <td>...</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203765</th>\n",
              "      <td>158303998</td>\n",
              "      <td>49</td>\n",
              "      <td>-0.167040</td>\n",
              "      <td>-0.139563</td>\n",
              "      <td>1.018602</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.157564</td>\n",
              "      <td>...</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203766</th>\n",
              "      <td>158303966</td>\n",
              "      <td>49</td>\n",
              "      <td>-0.167040</td>\n",
              "      <td>-0.139563</td>\n",
              "      <td>1.018602</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.157564</td>\n",
              "      <td>...</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203767</th>\n",
              "      <td>161526077</td>\n",
              "      <td>49</td>\n",
              "      <td>-0.172212</td>\n",
              "      <td>-0.139573</td>\n",
              "      <td>1.018602</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.162856</td>\n",
              "      <td>...</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203768</th>\n",
              "      <td>194103537</td>\n",
              "      <td>49</td>\n",
              "      <td>-0.172212</td>\n",
              "      <td>-0.139573</td>\n",
              "      <td>1.018602</td>\n",
              "      <td>-0.121970</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.162856</td>\n",
              "      <td>...</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>203769 rows × 184 columns</p>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-c00063ae-35bb-4adf-8b2f-f7a6d2444a13')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-c00063ae-35bb-4adf-8b2f-f7a6d2444a13 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-c00063ae-35bb-4adf-8b2f-f7a6d2444a13');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 4
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "Transaction classes: \n",
            "\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "             txId  class\n",
              "0            3321      3\n",
              "1           11108      3\n",
              "2           51816      3\n",
              "3           68869      2\n",
              "4           89273      2\n",
              "...           ...    ...\n",
              "203764  158304003      3\n",
              "203765  158303998      3\n",
              "203766  158303966      3\n",
              "203767  161526077      3\n",
              "203768  194103537      3\n",
              "\n",
              "[203769 rows x 2 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-7125e9e5-264a-400b-8350-964e714cea46\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>txId</th>\n",
              "      <th>class</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>3321</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>11108</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>51816</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>68869</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>89273</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203764</th>\n",
              "      <td>158304003</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203765</th>\n",
              "      <td>158303998</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203766</th>\n",
              "      <td>158303966</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203767</th>\n",
              "      <td>161526077</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>203768</th>\n",
              "      <td>194103537</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>203769 rows × 2 columns</p>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7125e9e5-264a-400b-8350-964e714cea46')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-7125e9e5-264a-400b-8350-964e714cea46 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-7125e9e5-264a-400b-8350-964e714cea46');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 4
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "Transaction-Transaction edgelist: \n",
            "\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "            txId1      txId2\n",
              "0       230425980    5530458\n",
              "1       232022460  232438397\n",
              "2       230460314  230459870\n",
              "3       230333930  230595899\n",
              "4       232013274  232029206\n",
              "...           ...        ...\n",
              "234350  158365409  157930723\n",
              "234351  188708874  188708879\n",
              "234352  157659064  157659046\n",
              "234353   87414554  106877725\n",
              "234354  158589452  158589457\n",
              "\n",
              "[234355 rows x 2 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-d1f1b9a8-013d-41b2-9b4c-e8badcdcad74\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>txId1</th>\n",
              "      <th>txId2</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>230425980</td>\n",
              "      <td>5530458</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>232022460</td>\n",
              "      <td>232438397</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>230460314</td>\n",
              "      <td>230459870</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>230333930</td>\n",
              "      <td>230595899</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>232013274</td>\n",
              "      <td>232029206</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>234350</th>\n",
              "      <td>158365409</td>\n",
              "      <td>157930723</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>234351</th>\n",
              "      <td>188708874</td>\n",
              "      <td>188708879</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>234352</th>\n",
              "      <td>157659064</td>\n",
              "      <td>157659046</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>234353</th>\n",
              "      <td>87414554</td>\n",
              "      <td>106877725</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>234354</th>\n",
              "      <td>158589452</td>\n",
              "      <td>158589457</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>234355 rows × 2 columns</p>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d1f1b9a8-013d-41b2-9b4c-e8badcdcad74')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-d1f1b9a8-013d-41b2-9b4c-e8badcdcad74 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-d1f1b9a8-013d-41b2-9b4c-e8badcdcad74');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 4
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "Data structure for an example transaction (txId = 272145560):"
      ],
      "metadata": {
        "id": "5Qw43a6xe9rN"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(\"\\ntxs_features.csv for txId = 272145560\\n\")\n",
        "df_txs_features[df_txs_features['txId']==272145560]\n",
        "\n",
        "print(\"\\ntxs_classes.csv for txId = 272145560\\n\")\n",
        "df_txs_classes[df_txs_classes['txId']==272145560]\n",
        "\n",
        "print(\"\\ntxs_edgelist.csv for txId = 272145560\\n\")\n",
        "df_txs_edgelist[(df_txs_edgelist['txId1']==272145560) | (df_txs_edgelist['txId2']==272145560)]"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 543
        },
        "id": "BHp9b7S1e1-F",
        "outputId": "757d6c2d-3c51-49f6-d0eb-2d701b52fc78"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "txs_features.csv for txId=272145560\n",
            "\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "             txId  Time step  Local_feature_1  Local_feature_2  \\\n",
              "105573  272145560         24        -0.155493        -0.107012   \n",
              "\n",
              "        Local_feature_3  Local_feature_4  Local_feature_5  Local_feature_6  \\\n",
              "105573        -1.201369         -0.12197        -0.043875        -0.113002   \n",
              "\n",
              "        Local_feature_7  Local_feature_8  ...  in_BTC_min  in_BTC_max  \\\n",
              "105573        -0.061584        -0.145749  ...      2.7732      2.7732   \n",
              "\n",
              "        in_BTC_mean  in_BTC_median  in_BTC_total  out_BTC_min  out_BTC_max  \\\n",
              "105573       2.7732         2.7732        2.7732     0.001917     2.770883   \n",
              "\n",
              "        out_BTC_mean  out_BTC_median  out_BTC_total  \n",
              "105573        1.3864          1.3864         2.7728  \n",
              "\n",
              "[1 rows x 184 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-d4c2c7c9-5a47-4c7b-88df-ca4a880bf464\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>txId</th>\n",
              "      <th>Time step</th>\n",
              "      <th>Local_feature_1</th>\n",
              "      <th>Local_feature_2</th>\n",
              "      <th>Local_feature_3</th>\n",
              "      <th>Local_feature_4</th>\n",
              "      <th>Local_feature_5</th>\n",
              "      <th>Local_feature_6</th>\n",
              "      <th>Local_feature_7</th>\n",
              "      <th>Local_feature_8</th>\n",
              "      <th>...</th>\n",
              "      <th>in_BTC_min</th>\n",
              "      <th>in_BTC_max</th>\n",
              "      <th>in_BTC_mean</th>\n",
              "      <th>in_BTC_median</th>\n",
              "      <th>in_BTC_total</th>\n",
              "      <th>out_BTC_min</th>\n",
              "      <th>out_BTC_max</th>\n",
              "      <th>out_BTC_mean</th>\n",
              "      <th>out_BTC_median</th>\n",
              "      <th>out_BTC_total</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>105573</th>\n",
              "      <td>272145560</td>\n",
              "      <td>24</td>\n",
              "      <td>-0.155493</td>\n",
              "      <td>-0.107012</td>\n",
              "      <td>-1.201369</td>\n",
              "      <td>-0.12197</td>\n",
              "      <td>-0.043875</td>\n",
              "      <td>-0.113002</td>\n",
              "      <td>-0.061584</td>\n",
              "      <td>-0.145749</td>\n",
              "      <td>...</td>\n",
              "      <td>2.7732</td>\n",
              "      <td>2.7732</td>\n",
              "      <td>2.7732</td>\n",
              "      <td>2.7732</td>\n",
              "      <td>2.7732</td>\n",
              "      <td>0.001917</td>\n",
              "      <td>2.770883</td>\n",
              "      <td>1.3864</td>\n",
              "      <td>1.3864</td>\n",
              "      <td>2.7728</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>1 rows × 184 columns</p>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d4c2c7c9-5a47-4c7b-88df-ca4a880bf464')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-d4c2c7c9-5a47-4c7b-88df-ca4a880bf464 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-d4c2c7c9-5a47-4c7b-88df-ca4a880bf464');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 5
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "txs_classes.csv for txId=272145560\n",
            "\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "             txId  class\n",
              "105573  272145560      1"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-2cb80618-7e36-43e1-bc3a-7916574c7b0d\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>txId</th>\n",
              "      <th>class</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>105573</th>\n",
              "      <td>272145560</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-2cb80618-7e36-43e1-bc3a-7916574c7b0d')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-2cb80618-7e36-43e1-bc3a-7916574c7b0d button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-2cb80618-7e36-43e1-bc3a-7916574c7b0d');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 5
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "txs_edgelist.csv for txId=272145560\n",
            "\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "            txId1      txId2\n",
              "123072  272145560  296926618\n",
              "123272  272145560  272145556\n",
              "125873  299475624  272145560"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-80dae61b-ee8e-4b72-a243-d2516eb56b84\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>txId1</th>\n",
              "      <th>txId2</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>123072</th>\n",
              "      <td>272145560</td>\n",
              "      <td>296926618</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>123272</th>\n",
              "      <td>272145560</td>\n",
              "      <td>272145556</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>125873</th>\n",
              "      <td>299475624</td>\n",
              "      <td>272145560</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-80dae61b-ee8e-4b72-a243-d2516eb56b84')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-80dae61b-ee8e-4b72-a243-d2516eb56b84 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-80dae61b-ee8e-4b72-a243-d2516eb56b84');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 5
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "\n",
        "Transaction features --- 94 local features, 72 aggregate features, 17 augmented features:\n"
      ],
      "metadata": {
        "id": "moS6bxoLg1Pk"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "list(df_txs_features.columns)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "RpljxgT7k49T",
        "outputId": "916b4dda-11d6-4f92-f10d-3d7040f10ea8"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "['txId',\n",
              " 'Time step',\n",
              " 'class',\n",
              " 'Local_feature_1',\n",
              " 'Local_feature_2',\n",
              " 'Local_feature_3',\n",
              " 'Local_feature_4',\n",
              " 'Local_feature_5',\n",
              " 'Local_feature_6',\n",
              " 'Local_feature_7',\n",
              " 'Local_feature_8',\n",
              " 'Local_feature_9',\n",
              " 'Local_feature_10',\n",
              " 'Local_feature_11',\n",
              " 'Local_feature_12',\n",
              " 'Local_feature_13',\n",
              " 'Local_feature_14',\n",
              " 'Local_feature_15',\n",
              " 'Local_feature_16',\n",
              " 'Local_feature_17',\n",
              " 'Local_feature_18',\n",
              " 'Local_feature_19',\n",
              " 'Local_feature_20',\n",
              " 'Local_feature_21',\n",
              " 'Local_feature_22',\n",
              " 'Local_feature_23',\n",
              " 'Local_feature_24',\n",
              " 'Local_feature_25',\n",
              " 'Local_feature_26',\n",
              " 'Local_feature_27',\n",
              " 'Local_feature_28',\n",
              " 'Local_feature_29',\n",
              " 'Local_feature_30',\n",
              " 'Local_feature_31',\n",
              " 'Local_feature_32',\n",
              " 'Local_feature_33',\n",
              " 'Local_feature_34',\n",
              " 'Local_feature_35',\n",
              " 'Local_feature_36',\n",
              " 'Local_feature_37',\n",
              " 'Local_feature_38',\n",
              " 'Local_feature_39',\n",
              " 'Local_feature_40',\n",
              " 'Local_feature_41',\n",
              " 'Local_feature_42',\n",
              " 'Local_feature_43',\n",
              " 'Local_feature_44',\n",
              " 'Local_feature_45',\n",
              " 'Local_feature_46',\n",
              " 'Local_feature_47',\n",
              " 'Local_feature_48',\n",
              " 'Local_feature_49',\n",
              " 'Local_feature_50',\n",
              " 'Local_feature_51',\n",
              " 'Local_feature_52',\n",
              " 'Local_feature_53',\n",
              " 'Local_feature_54',\n",
              " 'Local_feature_55',\n",
              " 'Local_feature_56',\n",
              " 'Local_feature_57',\n",
              " 'Local_feature_58',\n",
              " 'Local_feature_59',\n",
              " 'Local_feature_60',\n",
              " 'Local_feature_61',\n",
              " 'Local_feature_62',\n",
              " 'Local_feature_63',\n",
              " 'Local_feature_64',\n",
              " 'Local_feature_65',\n",
              " 'Local_feature_66',\n",
              " 'Local_feature_67',\n",
              " 'Local_feature_68',\n",
              " 'Local_feature_69',\n",
              " 'Local_feature_70',\n",
              " 'Local_feature_71',\n",
              " 'Local_feature_72',\n",
              " 'Local_feature_73',\n",
              " 'Local_feature_74',\n",
              " 'Local_feature_75',\n",
              " 'Local_feature_76',\n",
              " 'Local_feature_77',\n",
              " 'Local_feature_78',\n",
              " 'Local_feature_79',\n",
              " 'Local_feature_80',\n",
              " 'Local_feature_81',\n",
              " 'Local_feature_82',\n",
              " 'Local_feature_83',\n",
              " 'Local_feature_84',\n",
              " 'Local_feature_85',\n",
              " 'Local_feature_86',\n",
              " 'Local_feature_87',\n",
              " 'Local_feature_88',\n",
              " 'Local_feature_89',\n",
              " 'Local_feature_90',\n",
              " 'Local_feature_91',\n",
              " 'Local_feature_92',\n",
              " 'Local_feature_93',\n",
              " 'Aggregate_feature_1',\n",
              " 'Aggregate_feature_2',\n",
              " 'Aggregate_feature_3',\n",
              " 'Aggregate_feature_4',\n",
              " 'Aggregate_feature_5',\n",
              " 'Aggregate_feature_6',\n",
              " 'Aggregate_feature_7',\n",
              " 'Aggregate_feature_8',\n",
              " 'Aggregate_feature_9',\n",
              " 'Aggregate_feature_10',\n",
              " 'Aggregate_feature_11',\n",
              " 'Aggregate_feature_12',\n",
              " 'Aggregate_feature_13',\n",
              " 'Aggregate_feature_14',\n",
              " 'Aggregate_feature_15',\n",
              " 'Aggregate_feature_16',\n",
              " 'Aggregate_feature_17',\n",
              " 'Aggregate_feature_18',\n",
              " 'Aggregate_feature_19',\n",
              " 'Aggregate_feature_20',\n",
              " 'Aggregate_feature_21',\n",
              " 'Aggregate_feature_22',\n",
              " 'Aggregate_feature_23',\n",
              " 'Aggregate_feature_24',\n",
              " 'Aggregate_feature_25',\n",
              " 'Aggregate_feature_26',\n",
              " 'Aggregate_feature_27',\n",
              " 'Aggregate_feature_28',\n",
              " 'Aggregate_feature_29',\n",
              " 'Aggregate_feature_30',\n",
              " 'Aggregate_feature_31',\n",
              " 'Aggregate_feature_32',\n",
              " 'Aggregate_feature_33',\n",
              " 'Aggregate_feature_34',\n",
              " 'Aggregate_feature_35',\n",
              " 'Aggregate_feature_36',\n",
              " 'Aggregate_feature_37',\n",
              " 'Aggregate_feature_38',\n",
              " 'Aggregate_feature_39',\n",
              " 'Aggregate_feature_40',\n",
              " 'Aggregate_feature_41',\n",
              " 'Aggregate_feature_42',\n",
              " 'Aggregate_feature_43',\n",
              " 'Aggregate_feature_44',\n",
              " 'Aggregate_feature_45',\n",
              " 'Aggregate_feature_46',\n",
              " 'Aggregate_feature_47',\n",
              " 'Aggregate_feature_48',\n",
              " 'Aggregate_feature_49',\n",
              " 'Aggregate_feature_50',\n",
              " 'Aggregate_feature_51',\n",
              " 'Aggregate_feature_52',\n",
              " 'Aggregate_feature_53',\n",
              " 'Aggregate_feature_54',\n",
              " 'Aggregate_feature_55',\n",
              " 'Aggregate_feature_56',\n",
              " 'Aggregate_feature_57',\n",
              " 'Aggregate_feature_58',\n",
              " 'Aggregate_feature_59',\n",
              " 'Aggregate_feature_60',\n",
              " 'Aggregate_feature_61',\n",
              " 'Aggregate_feature_62',\n",
              " 'Aggregate_feature_63',\n",
              " 'Aggregate_feature_64',\n",
              " 'Aggregate_feature_65',\n",
              " 'Aggregate_feature_66',\n",
              " 'Aggregate_feature_67',\n",
              " 'Aggregate_feature_68',\n",
              " 'Aggregate_feature_69',\n",
              " 'Aggregate_feature_70',\n",
              " 'Aggregate_feature_71',\n",
              " 'Aggregate_feature_72',\n",
              " 'in_txs_degree',\n",
              " 'out_txs_degree',\n",
              " 'total_BTC',\n",
              " 'fees',\n",
              " 'size',\n",
              " 'num_input_addresses',\n",
              " 'num_output_addresses',\n",
              " 'in_BTC_min',\n",
              " 'in_BTC_max',\n",
              " 'in_BTC_mean',\n",
              " 'in_BTC_median',\n",
              " 'in_BTC_total',\n",
              " 'out_BTC_min',\n",
              " 'out_BTC_max',\n",
              " 'out_BTC_mean',\n",
              " 'out_BTC_median',\n",
              " 'out_BTC_total']"
            ]
          },
          "metadata": {},
          "execution_count": 21
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "1-J38vk9fKfg"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## EASY, HARD, and AVERAGE cases Analysis\n",
        "\n",
        "\n",
        "---\n",
        "\n",
        "This section analyzes EASY, HARD, and AVERAGE cases (only refers to illicit transactions):\n",
        "\n",
        "\n",
        "1.   **EASY** cases: all models classify an illicit transaction correctly\n",
        "2.   **HARD** cases: all models classify an illicit transaction incorrectly\n",
        "3.   **AVERAGE** cases: some models failed to classify an illicit transaction but  ≥1 models classified correctly\n"
      ],
      "metadata": {
        "id": "3aHWohviwlLm"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Correct base values in the test set ('0': licit, '1': illicit):"
      ],
      "metadata": {
        "id": "C1lxkHAM0z49"
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "FjFx4k3bVgi9",
        "outputId": "12fae872-c9a5-487c-dae7-8cf2460aca0f"
      },
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "0    15263\n",
              "1     1083\n",
              "Name: class, dtype: int64"
            ]
          },
          "metadata": {},
          "execution_count": 65
        }
      ],
      "source": [
        "y_test.value_counts()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ba4QfxncelQr",
        "outputId": "add39cde-e691-45fb-ee67-4e7f711955ec"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Number of EASY CASES: \n",
            "49\n"
          ]
        }
      ],
      "source": [
        "# EASY CASES: fraud transactions that all 5 models identified correctly\n",
        "indices_easy_fraud = [i for i in range(len(y_test.values)) if ((y_test.values[i] == 1) and (y_test.values[i] == y_preds_LR[i]) and (y_test.values[i] == y_preds_RF[i]) and (y_test.values[i] == y_preds_MLP[i]) and (y_test.values[i] == y_preds_LSTM[i]) and (y_test.values[i] == y_preds_XGB[i]))]\n",
        "print(\"Number of EASY CASES: \")\n",
        "print(len(indices_easy_fraud))\n",
        "wrong_predictions_easy = X_testing_timesteps.iloc[indices_easy_fraud,:]\n",
        "wrong_predictions_easy2 = wrong_predictions_easy.drop(columns=wrong_predictions_easy.columns.difference(['txId', 'class', 'Time step']))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "z6qXWtkTiN-2",
        "outputId": "71ffc581-b97b-4883-bd76-aa4454576587"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Number of EASY CASES in each time step:\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "35    32\n",
              "37     2\n",
              "38     5\n",
              "39     5\n",
              "40     1\n",
              "41     1\n",
              "42     3\n",
              "Name: Time step, dtype: int64"
            ]
          },
          "metadata": {},
          "execution_count": 39
        }
      ],
      "source": [
        "# EASY CASES: number in each time step\n",
        "print(\"Number of EASY CASES in each time step:\")\n",
        "wrong_predictions_easy2['Time step'].value_counts().sort_index()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "nQ1MrfN5elQs",
        "outputId": "da0a5711-5b92-4c55-a22d-96d38da27134"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Number of HARD CASES: \n",
            "243\n"
          ]
        }
      ],
      "source": [
        "# HARD CASES: fraud transactions that all 5 models failed to identify\n",
        "indices_hard_fraud = [i for i in range(len(y_test.values)) if ((y_test.values[i] == 1) and (y_test.values[i] != y_preds_LR[i]) and (y_test.values[i] != y_preds_RF[i]) and (y_test.values[i] != y_preds_MLP[i]) and (y_test.values[i] != y_preds_LSTM[i]) and (y_test.values[i] != y_preds_XGB[i]))]\n",
        "print(\"Number of HARD CASES: \")\n",
        "print(len(indices_hard_fraud))\n",
        "wrong_predictions_hard = X_testing_timesteps.iloc[indices_hard_fraud,:]\n",
        "wrong_predictions_hard2 = wrong_predictions_hard.drop(columns=wrong_predictions_hard.columns.difference(['txId', 'class', 'Time step']))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "m3DTyiECi1vh",
        "outputId": "0fe3e496-4a18-4612-baec-4f1467535046"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Number of HARD CASES in each time step:\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "35     4\n",
              "37    10\n",
              "38     7\n",
              "39     4\n",
              "40    28\n",
              "41     6\n",
              "42    36\n",
              "43    22\n",
              "44    20\n",
              "45     4\n",
              "46     1\n",
              "47    21\n",
              "48    27\n",
              "49    53\n",
              "Name: Time step, dtype: int64"
            ]
          },
          "metadata": {},
          "execution_count": 41
        }
      ],
      "source": [
        "# HARD CASES: number in each time step\n",
        "print(\"Number of HARD CASES in each time step:\")\n",
        "wrong_predictions_hard2['Time step'].value_counts().sort_index()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "2QplDa5-elQt",
        "outputId": "f849d8f0-2b4d-4771-a6f5-e901e8f69443"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Number of AVERAGE CASES: \n",
            "98\n"
          ]
        }
      ],
      "source": [
        "# AVERAGE CASES: fraud transactions that some models failed but at least 1 of the 5 models succeed\n",
        "indices_avg_fraud = [i for i in range(len(y_test.values)) if ( \n",
        "    #((y_test.values[i] == 1) and (y_test.values[i] == y_preds_LR[i]) and (y_test.values[i] != y_preds_RF[i]) and (y_test.values[i] != y_preds_MLP[i]) and (y_test.values[i] != y_preds_LSTM[i]) and (y_test.values[i] != y_preds_XGB[i]))# or\n",
        "    ((y_test.values[i] == 1) and (y_test.values[i] == y_preds_LR[i]) and (y_test.values[i] == y_preds_RF[i]) and (y_test.values[i] != y_preds_MLP[i]) and (y_test.values[i] != y_preds_LSTM[i]) and (y_test.values[i] == y_preds_XGB[i]))# or\n",
        "    #((y_test.values[i] == 1) and (y_test.values[i] == y_preds_LR[i]) and (y_test.values[i] == y_preds_RF[i]) and (y_test.values[i] != y_preds_MLP[i])) or\n",
        "    #((y_test.values[i] == 1) and (y_test.values[i] == y_preds_LR[i]) and (y_test.values[i] != y_preds_RF[i]) and (y_test.values[i] == y_preds_MLP[i])) or\n",
        "    #((y_test.values[i] == 1) and (y_test.values[i] != y_preds_LR[i]) and (y_test.values[i] == y_preds_RF[i]) and (y_test.values[i] != y_preds_MLP[i])) or\n",
        "    #((y_test.values[i] == 1) and (y_test.values[i] != y_preds_LR[i]) and (y_test.values[i] == y_preds_RF[i]) and (y_test.values[i] == y_preds_MLP[i])) or\n",
        "    #((y_test.values[i] == 1) and (y_test.values[i] != y_preds_LR[i]) and (y_test.values[i] != y_preds_RF[i]) and (y_test.values[i] == y_preds_MLP[i]))\n",
        "    )]\n",
        "print(\"Number of AVERAGE CASES: \")\n",
        "print(len(indices_avg_fraud))\n",
        "wrong_predictions_avg = X_testing_timesteps.iloc[indices_avg_fraud,:]\n",
        "wrong_predictions_avg2 = wrong_predictions_avg.drop(columns=wrong_predictions_avg.columns.difference(['txId', 'class', 'Time step']))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Tk20imfZjUF5",
        "outputId": "52f11839-62e8-402a-e3f5-14c3e8ede2ba"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Number of AVERAGE CASES in each time step:\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "35     6\n",
              "36     1\n",
              "37    10\n",
              "38    27\n",
              "39    18\n",
              "40    10\n",
              "41     5\n",
              "42    21\n",
              "Name: Time step, dtype: int64"
            ]
          },
          "metadata": {},
          "execution_count": 94
        }
      ],
      "source": [
        "# AVERAGE CASES: number in each time step\n",
        "print(\"Number of AVERAGE CASES in each time step:\")\n",
        "wrong_predictions_avg2['Time step'].value_counts().sort_index()"
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "bOk6Ic9Ms7vc"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "# **Acknowledgements**\n",
        "\n",
        "\n",
        "---\n",
        "---\n",
        "\n",
        "\n",
        "Released by: Youssef Elmougy, Ling Liu\n",
        "\n",
        "\n",
        "\n",
        "School of Computer Science, Georgia Institute of Technology\n",
        "\n",
        "Contact: yelmougy3@gatech.edu\n",
        "\n",
        "\n",
        "---\n",
        "\n",
        "Github Repository: [https://www.github.com/git-disl/EllipticPlusPlus](https://www.github.com/git-disl/EllipticPlusPlus)\n",
        "\n",
        "\n",
        "If you use our dataset in your work, please cite our paper:\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "\n",
        ">> Youssef Elmougy and Ling Liu. 2023. Demystifying Fraudulent Transactions and Illicit Nodes in the Bitcoin Network for Financial Forensics.\n",
        "\n",
        "---\n",
        "\n"
      ],
      "metadata": {
        "id": "BwrFHYfy5hrz"
      }
    }
  ]
}